# compile collection
cc=g++
# exe Object
Parser=parser
DEBUG_LOCAL_SERVER=debug
HTTP_SERVER=http_server

logTarget=logtest
test=test.cc
loghead=log.hpp

.PHONY:all
all: $(Parser)  $(HTTP_SERVER)
#$(DEBUG_LOCAL_SERVER)
# ===== parser =====
$(Parser): parser.o
	$(cc) -o $@ $^ -lboost_filesystem -lboost_system

parser.o: parser.cpp
	$(cc) -c $< -o $@


# ===== http_server =====
$(HTTP_SERVER): http_server.o
	$(cc) -o $@ $^ -ljsoncpp -lcpp-httplib -lpthread

http_server.o: http_server.cpp
	$(cc) -g -c $< -o $@

# ===== debug =====
# $(DEBUG_LOCAL_SERVER): debug.o
# 	$(cc) -o $@ $^ -ljsoncpp

# debug.o: debug.cpp searcher.hpp index.hpp util.hpp
# 	$(cc) -g -c $< -o $@

# ===== util =====
# util.o: util.cpp util.hpp
# 	$(cc) -c $< -o $@

$(logTarget): $(test) $(loghead)
	$(cc) -o $@ $^

.PHONY:clean
clean:
	rm -f $(Parser) $(DEBUG_LOCAL_SERVER) $(HTTP_SERVER) $(logTarget) *.o *.i *.s